package cn.xin.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum ShopStateEnum {
    AUDIT(0,"待审核"),
    AUDIT_NOT_ACTIVE(1,"待激活"),
    AUDIT_REJECT(2,"驳回"),
    ACTIVITY(3,"已激活");


    public static String getNameByCode(Integer code){
        Optional<ShopStateEnum> first = Arrays.stream(ShopStateEnum.values()).filter(state -> state.getCode() == code)
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private int code;

    private String name;
}
